define(['knockout', 'director', 'ko-map', 'ko-amd'], function(ko) {
	var dishRouter = Router({});
	dishRouter.init();
	var vm = {
		menuName: ko.observable('测试'),
		dishCatalog: ko.observableArray(),
		dishModuleOpts: ko.observable(),
		init: function() {
			//			$(function() {
			//				var $container = $('#catContainer');
			//				$container.infinitescroll({
			//					navSelector: '#page-nav',
			//					nextSelector: '#page-nav a',
			//					itemSelector: '.box',
			//					loading: {
			//						finishedMsg: '没有更多的页面加载。',
			//						loadingText: '加载中',
			//						img: 'images/loading.gif'
			//					}
			//				}, function(newElements) {
			//					var $newElems = $(newElements).css({
			//						opacity: 0
			//					});
			//					$newElems.imagesLoaded(function() {
			//						$newElems.animate({
			//							opacity: 1
			//						});
			//						$container.masonry('appended', $newElems, true);
			//					});
			//				});
			//			})
			var that = this;
			$.getJSON('/shop/json/example.json', function(returnData) {
				$.each(returnData.catalogs, function(index, data) {
					that.dishCatalog.push(data);
				});
			});
			dishRouter.on('/catalog/:catalogId', function(catalogId) {
				that.dishModuleOpts({
					name: 'modules/public/dish/catalog',
					template: 'templates//public/dish/catalog'
				})
			});
			dishRouter.on('/item/:itemId', function(itemId) {
				that.dishModuleOpts({
					name: 'modules/public/dish/item',
					template: 'templates//public/dish/item'
				})
			});
		}
	};
	vm.init();
	return vm;
})